interview questions on reduce method